-- Copyright (c) 2025 Huawei Technologies Co., Ltd.
-- openUBMC is licensed under Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
-- EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
-- MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
-- See the Mulan PSL v2 for more details.

local cert_enum = require 'spdm.json_types.CertificateService'

local KU_DIGITAL_SIGNATURE = 0x0080
local KU_NON_REPUDIATION   = 0x0040
local KU_KEY_ENCIPHERMENT  = 0x0020
local KU_DATA_ENCIPHERMENT = 0x0010
local KU_KEY_AGREEMENT     = 0x0008
local KU_KEY_CERT_SIGN     = 0x0004
local KU_CRL_SIGN          = 0x0002
local KU_ENCIPHER_ONLY     = 0x0001
local KU_DECIPHER_ONLY     = 0x8000

return {
    KU_BIT_MAP = {
        [KU_DIGITAL_SIGNATURE] = cert_enum.KeyUsage.DigitalSignature,
        [KU_NON_REPUDIATION]   = cert_enum.KeyUsage.NonRepudiation,
        [KU_KEY_ENCIPHERMENT]  = cert_enum.KeyUsage.KeyEncipherment,
        [KU_DATA_ENCIPHERMENT] = cert_enum.KeyUsage.DataEncipherment,
        [KU_KEY_AGREEMENT]     = cert_enum.KeyUsage.KeyAgreement,
        [KU_KEY_CERT_SIGN]     = cert_enum.KeyUsage.KeyCertSign,
        [KU_CRL_SIGN]          = cert_enum.KeyUsage.CRLSigning,
        [KU_ENCIPHER_ONLY]     = cert_enum.KeyUsage.EncipherOnly,
        [KU_DECIPHER_ONLY]     = cert_enum.KeyUsage.DecipherOnly
    }
}